<?php
namespace app\index\model;
use think\Model;
class BuyRecord extends Model
{
	protected $resultSetType = 'collection';
	public function buyrecord(){
		$db = model('user')
			->alias('a')
            ->join('sp_indent i','i.userid = a.id')
            ->join('sp_issue is','i.issueid = is.id')
            ->join('sp_agency ag','ag.id = is.agencyid')           
            ->field('i.id,dnumber,a.id as uid ,a.name as uname,is.name as iname,shop,i.times,i.number as inumber')
            ->select();
            $arr = array();
            foreach ($db as $value) {
            	$arr[] = $value->toArray();
            }
        return $arr;
	} 

}